/*
 * Alexey Danchuk
 * This software is an implementation of the task from OOP module.
 */
package testsystem;

import factory.DatabaseFactory;
import factory.FileDatabase;
import factory.ManualyDatabase;
import java.io.IOException;
import question.Question;
import repository.QuestionsRepository;

/**
 * This class describes our test.
 *
 * @version 1.01 23 February 2013
 * @author Alexey Danchuk
 */
public class Test {

    private QuestionsRepository repository;
    private DatabaseFactory factory;

    protected void initializationTest(String fileNmae) throws IOException,
            Exception {
        factory = new FileDatabase();
        factory.createDatabase(fileNmae);
    }

    protected void initializationTest() throws IOException,
            Exception {
        factory = new ManualyDatabase();
        factory.createDatabase();
    }

    protected Question takeTheTest() {
        int testSize = repository.size();
        Question question = null;
        for (int i = 0; i < testSize; i++) {
            question = repository.get(i);
        }
        return question;
    }
}
